package com.zyj.mybatis.service;


import org.apache.ibatis.session.SqlSession;

import com.zyj.mybatis.beans.CoursesBean;
import com.zyj.mybatis.beans.StudentBean;
import com.zyj.mybatis.mapper.CoursesMapper;
import com.zyj.mybatis.mapper.StudentMapper;
import com.zyj.mybatis.tools.DBTools;

public class ManyToManyService {
	 public static void main(String[] args) {
	        
	        findStudentByCourses();
	        findCoursesByStudent();
	    }

	    

	    private static void findCoursesByStudent() {
	        SqlSession session = DBTools.getSession();
	        StudentMapper sm=session.getMapper(StudentMapper.class);
	        StudentBean sb=sm.findStuAndCou(1);
	        System.out.println(sb);
	        
	    }



	    private static void findStudentByCourses() {
	        SqlSession session = DBTools.getSession();
	        CoursesMapper cm=session.getMapper(CoursesMapper.class);
	        CoursesBean cb=cm.findCouAndStu(2);
	        System.out.println(cb);
	    }

}
